<seed-content class="default-bg">
  <seed-toolbar-header>
    <seed-toolbar-title>学员信息登记</seed-toolbar-title>
    <seed-toolbar-menu></seed-toolbar-menu>
  </seed-toolbar-header>
  <div class="seed-gap"></div>
  <form [formGroup]="signForm">

    <seed-form-input
      [placeholder]="'请输入真实姓名'"
      [title]="'姓名'"
      formControlName="name"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['name'].errors" >请填写真实姓名</p>
    </seed-form-input>

    <seed-form-input
      [type]="'tel'"
      [title]="'监护人手机'"
      formControlName="phone"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['phone'].errors" >请输入有效的手机号</p>
    </seed-form-input>

    <seed-form-input
      [placeholder]="'请输入真实姓名'"
      *ngIf="config.parentName.hasItem"
      [title]="'监护人姓名'"
      formControlName="parentName"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['parentName'].errors" >请填写真实姓名</p>
    </seed-form-input>

    <seed-form-select-sex [placeHolder]="'请选择学员性别'" *ngIf="config.sex.hasItem"  formControlName="sex" ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['sex'].errors">请选择性别</p>
    </seed-form-select-sex>

    <seed-form-select-date
      *ngIf="config.birthday.hasItem"
      [ngClass]="{'last-item': addition?.length === 0}"
      formControlName="birthday"
      [placeholder]="'请选择出生日期'"
      ngDefaultControl >
      <p class="error-tip" *ngIf="signForm.controls['birthday'].errors">请选择出生日期</p>
    </seed-form-select-date>

    <ng-container formGroupName="idNo" *ngIf="config.idNo.hasItem">

      <seed-form-input
        *ngIf="config.idNo.hasItem"
        [placeholder]="'请输入有效证件号'"
        [title]="'证件号'"
        formControlName="num"
        ngDefaultControl>
        <p class="error-tip" *ngIf="signForm.hasError('invalidIdNum') || signForm.controls['idNo'].controls['num'].errors">请输入真实有效证件号</p>
        <!--<p class="error-tip" *ngIf="signForm.hasError('invalidIdNum')" >请输入真实有效证件号</p>-->
      </seed-form-input>

      <seed-form-select
        (valueChange)="certificateChange($event)"
        *ngIf="config.idNo.hasItem"
        [arr]="certificateArr"
        [title]="'证件类型'"
        [optionsText]="'title'"
        [optionsValue]="'value'"
        formControlName="certificate"
        ngDefaultControl>
      </seed-form-select>
    </ng-container>

    <seed-form-input
      *ngIf="config.address.hasItem"
      [title]="'家庭住址'"
      formControlName="address"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['address'].errors" >请填写学员家庭地址</p>
    </seed-form-input>

    <seed-form-input
      *ngIf="config.weight.hasItem"
      [placeholder]="'请输入学员体重'"
      [type]="'tel'" [title]="'体重(KG)'"
      formControlName="weight"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['weight'].errors" >请输入学员真实体重</p>
    </seed-form-input>

    <seed-form-input
      *ngIf="config.height.hasItem"
      [placeholder]="'请输入学员身高'"
      [type]="'tel'" [title]="'身高(CM)'"
      formControlName="height"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['height'].errors" >请输入学员真实身高</p>
    </seed-form-input>

    <seed-form-input
      *ngIf="config.trait.hasItem"
      [title]="'专业特点'"
      formControlName="trait"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['trait'].errors" >请输入学员专业特点</p>
    </seed-form-input>

    <seed-form-input
      *ngIf="config.sportItem.hasItem"
      [placeholder]="'请输入运动项目'"
      [title]="'运动项目'"
      formControlName="sportItem"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['sportItem'].errors" >请输入运动项目</p>
    </seed-form-input>

    <seed-form-input
      *ngIf="config.awardsItem.hasItem"
      [placeholder]="'请输入所获奖项'"
      [title]="'所获奖项'"
      formControlName="awardsItem"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['awardsItem'].errors" >请输入所获奖项</p>
    </seed-form-input>

    <seed-form-input
      *ngIf="config.school.hasItem"
      [placeholder]="'请输入就读学校'"
      [title]="'就读学校'"
      formControlName="school"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['school'].errors" >请输入就读学校</p>
    </seed-form-input>

    <seed-form-input
      *ngIf="config.remark.hasItem"
      [placeholder]="'请输入备注'"
      [title]="'备注'"
      formControlName="remark"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['remark'].errors" >请输入备注</p>
    </seed-form-input>

    <seed-form-select
      [title]="'国籍'"
      *ngIf="config.nationality.hasItem"
      (valueChange)="countryChange($event)"
      [arr]="countryGroup"
      [optionsText]="'countryChineseName'"
      [optionsValue]="'countryCode'"
      formControlName="nationality"
      ngDefaultControl>

    </seed-form-select>

    <seed-form-input
      *ngIf="config.nation.hasItem && ( !signForm.controls['nationality'] || signForm.controls['nationality'].value === '100000' )"
      [title]="'民族'"
      formControlName="nation"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['nation'].errors" >请输入民族</p>
    </seed-form-input>

    <div class="seed-underline" (click)="showArea()" *ngIf="config.origin.hasItem && ( !signForm.controls['nationality'] || signForm.controls['nationality'].value === '100000' )">
      <label class="item place-item">
        <span class="title" [class.has-change]="config.origin.hasChange">籍贯</span>
        <span class="place-holder">{{origin.text}}</span>
      </label>
    </div>

    <seed-form-input
      *ngIf="config.email.hasItem"
      [placeholder]="'请填写邮箱地址'"
      [title]="'电子邮箱'" formControlName="email"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['email'].errors" >请输入正确的邮箱</p>
    </seed-form-input>
  </form>
  <seed-submit-button [btnText]="'确认'"  class="seed-scroll-outside"
                      [disabled]="!signForm.valid ||  !checkOrigin()"
                      (submit)="sign()"></seed-submit-button>
</seed-content>
<seed-modal [content]="content" >
  <seed-regio-picker class="seed-modal-content" [tier]="2" (complete)="pickerFinish($event)"></seed-regio-picker>
</seed-modal>
